package org.wsdltools.profiles.az



import org.wsdltools.common.model.MEPEnum;
import org.wsdltools.common.model.ServiceInteraction;

/**
 * Category to enrich the domain model with behaviour required by the generators
 * @author johan
 *
 */
class ServiceInteractionWsdlDSL {
	
	/**
	 * urn:${domain root}:${business context}:${domain}:services:${operationName}:${m}
	 * 
	 * @author johan
	 *
	 */	
	static String getWsdlTargetNamespace(ServiceInteraction that) {
		"urn:${that.serviceDomain.root}:${that.serviceDomain.domain}:${that.serviceDomain.subDomain}:services:${that.name}:${that.version.majorVersion}"
	}
	
	/**
	 * urn:${domain root}:${business context}:${domain}:services:${operationName}Responder:${m}
	 * 
	 * @author johan
	 *
	 */	
	static String getResponderServiceSchemaTargetNamespace(ServiceInteraction that) {
		"urn:${that.serviceDomain.root}:${that.serviceDomain.domain}:${that.serviceDomain.subDomain}:services:${that.name}Responder:${that.version.majorVersion}"
	}	
	
	/**
	 * urn:${domain root}:${business context}:${domain}:services:${operationName}Initiator:${m}
	 * 
	 * @author johan
	 *
	 */	
	static String getInitiatorServiceSchemaTargetNamespace(ServiceInteraction that) {
		"urn:${that.serviceDomain.root}:${that.serviceDomain.domain}:${that.serviceDomain.subDomain}:services:${that.name}Initiator:${that.version.majorVersion}"
	}
	
	/**
	 * urn:riv:${tjänsteDomän}:${m}
	 * 
	 * @author johan
	 *
	 */	
	static String getCoreSchemaNamespace(ServiceInteraction that) {
		"urn:${that.serviceDomain.root}:${that.serviceDomain.domain}:${that.serviceDomain.subDomain}:domain:${that.version.majorVersion}"
	}	
	
	/**
	 * ${subDomainWithfirstCharUpperCase}Base.xsd
	 * @param that
	 * @return
	 */
	static String getCoreSchemaName(ServiceInteraction that) {
		"${helpWithBaseSchemaFileName(that)}Base.xsd"
	}	
	
	/**
	* ${subDomainWithfirstCharUpperCase}Domain_${m}_${n}
	* @param that
	* @return
	*/
   static String getCoreSchemaDirName(ServiceInteraction that) {
	   "${helpWithBaseSchemaFileName(that)}Domain_${that.version.majorVersion}_${that.version.minorVersion}"
   }
	
   static String getWsdlDirName(ServiceInteraction that) {
	   "${that.name}Interaction_${that.version.majorVersion}_${that.version.minorVersion}"
   }
   
	/**
	 * ${OperationName}Initiator.xsd
	 * @param that
	 * @return
	 */
	static String getInitiatorSchemaName(ServiceInteraction that) {
		"${that.name}Initiator.xsd"
	}
	
	/**
	 * ${InetarctionName}Responder.xsd
	 * @param that
	 * @return
	 */	
	static String getResponderSchemaName(ServiceInteraction that) {
		"${that.name}Responder.xsd"
	}
	
	/**
	 * ${InetarctionName}Interaction.wsdl
	 * @param that
	 * @return
	 */	
	static String getWsdlFileName(ServiceInteraction that) {
		"${that.name}Interaction.wsdl"
	}
	
	static String helpWithBaseSchemaFileName(ServiceInteraction that) {
		that.serviceDomain.subDomain.substring(0,1).toUpperCase() + that.serviceDomain.subDomain.substring(1)
	}

}
